package com.sky.context;

public class BaseContext {
    /*
        ThreadLocal中只能存储一个数据
     */
    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    //写入数据
    public static void setCurrentUserId(Long userId){
        threadLocal.set(userId);
    }

    //获取数据
    public static Long getCurrentUserId(){
        return threadLocal.get();
    }

    //删除数据
    public static void remove(){
        threadLocal.remove();
    }

}
